<%-- 
    Document   : eliminarUsuario
    Created on : 28/10/2011, 11:09:43 AM
    Author     : Ramiro Vergara
--%>

<%@ page import="java.util.Iterator" %>
<%@ page import="com.myapp.struts.Usuario" %>
<%@ page import="java.util.List" %>
<%@ page import="com.myapp.struts.UsuarioHelper" %>
<%@ page contentType="text/html" pageEncoding="UTF-8" %>
<!DOCTYPE html>
  <%
        String user = request.getParameter("username");
        UsuarioHelper helper = new UsuarioHelper();
        List<Usuario> l = helper.getUsers();
        if (!l.isEmpty()) {
            int k =0;
            String usu;
            String max1 = request.getParameter("Max"); 
            int max = Integer.valueOf(max1).intValue();
            while (k < max+1) {
            usu = request.getParameter("username"+k);
               if (usu != null){System.out.println("AQUI es = "+request.getParameter("name"+k));
                    helper.deleteUser(request.getParameter("name"+k));  
                    helper = new UsuarioHelper();    
                }
               // }
               
            k++;    
            }
            
            String usern = request.getParameter("user"); 
            String Box = request.getParameter("Box");
            String Gusr = request.getParameter("gusr") ;
            if (Gusr.equals("eliminar2uc"))
                response.sendRedirect("eliminarUserC.jsp?username="+user+"&gusr="+Gusr+"&user="+usern); 
            else if (Gusr.equals("eliminar2nc"))
            response.sendRedirect("eliminarNombrec.jsp?username="+user+"&gusr="+Gusr+"&user="+usern); 
            else if (Gusr.equals("eliminar2cc"))
            response.sendRedirect("eliminarCategoriac.jsp?username="+user+"&gusr="+Gusr+"&Box="+Box);
        }
%>